"use strict";
const common_vendor = require("../common/vendor.js");
const tabbarItems = common_vendor.ref([
  { name: "home", value: null, active: true, title: "首页", icon: "home" }
  // { name: 'about', value: null, active: false, title: '关于', icon: 'user' },
]);
function useTabbar() {
  const tabbarList = common_vendor.computed(() => tabbarItems.value);
  const activeTabbar = common_vendor.computed(() => {
    const item = tabbarItems.value.find((item2) => item2.active);
    return item || tabbarItems.value[0];
  });
  const getTabbarItemValue = (name) => {
    const item = tabbarItems.value.find((item2) => item2.name === name);
    return item && item.value ? item.value : null;
  };
  const setTabbarItem = (name, value) => {
    const tabbarItem = tabbarItems.value.find((item) => item.name === name);
    if (tabbarItem) {
      tabbarItem.value = value;
    }
  };
  const setTabbarItemActive = (name) => {
    tabbarItems.value.forEach((item) => {
      if (item.name === name) {
        item.active = true;
      } else {
        item.active = false;
      }
    });
  };
  return {
    tabbarList,
    activeTabbar,
    getTabbarItemValue,
    setTabbarItem,
    setTabbarItemActive
  };
}
exports.useTabbar = useTabbar;
